﻿using System.Windows.Input;
using ESRI.ArcGIS.Client;

namespace Apps.Maps
{
    public class RectZoomIn : MapToolsBase
    {
        public override void Show()
        {
            this.IsShowed = true;
            // 处理组件互斥操作。
            this.ExclusionWidget();
            if (ActiveMap == null) return;
            //拉框放大，改变鼠标，设定画图的类型
            ActiveMap.Cursor = Cursors.Arrow;
            drawTool_mainMap.IsEnabled = true;
            mapService.DrawComplete += new System.EventHandler<DrawEventArgs>(mapService_DrawComplete);
            mapService.DrawBegin -= null;
        }
        /// <summary>
        /// 为垃框放大做的画图结束处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void mapService_DrawComplete(object sender, DrawEventArgs e)
        {
            //放大用户的垃框
            ActiveMap.ZoomTo(e.Geometry);
        }
        public override void Close()
        {
            this.IsShowed = false;
            if (ActiveMap == null) return;
            drawTool_mainMap.IsEnabled = false;
            ActiveMap.Cursor = Cursors.Hand;
            //base.Close();
        }
    }
}
